package gamagora.game.entity
{
	import gamagora.game.resources.OSImages;
	
	import org.flixel.FlxG;

	public class OSFakir extends OSEntity
	{
		private static const SPEED:Number = 5.0;
		
		private var _fakir2:Boolean;
		private var _goUp:Boolean;
		
		public function OSFakir(X:Number=0, Y:Number=0, fakir2:Boolean = false)
		{
			super(NOTHING, X, Y, fakir2 ? OSImages.FAKIR2 : OSImages.FAKIR1);
			_fakir2 = fakir2;
			offset.y = _fakir2 ? 20 : -8;
			
			if(!_fakir2)
			{
				add(new OSBird(X + 44, Y - 20));
			}
		}
		
		public override function update():void
		{
			super.update();
			
			if(_fakir2)
			{
				if(_goUp)
				{
					y -= FlxG.elapsed * SPEED;
					if(y < _startY - 5)
					{
						_goUp = false;
					}
				}
				else
				{
					y += FlxG.elapsed * SPEED;
					if(y >= _startY + 5)
					{
						_goUp = true;
					}
				}
			}
		}
	}
}
